__author__ = 'Dhananjayan'

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time


driver = webdriver.Firefox()
driver.get("http://www.python.org")
assert "Python" in driver.title
elem = driver.find_element_by_name("q")
elem.send_keys("pycon")
#elem.send_keys(Keys.RETURN)
elem = driver.find_element_by_id("submit")
elem.click()

print(driver.execute_script("return document.readyState"))
driver.implicitly_wait(10)
print(driver.execute_script("return document.readyState"))

try:
    assert "No results found." in driver.page_source.strip(),'object not found'
except AssertionError as e:
    print str(e.__str__()).capitalize()

print(driver.title)

print driver.name
#TODO : Datadrive test
time.sleep(5)
driver.close()
